-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: get zig build test
working
#18207
base: main
Are you sure you want to change the base?
Conversation
Updated 6:07 PM PT - Mar 25th, 2025
❌ @DonIsaac, your commit 685c89f has 1 failures in
🧪 try this PR locally: bunx bun-pr 18207 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mostly nits, and I think this should be reviewed by someone else more familiar with the build system and CI than me
const obj = Build.LazyPath{ .generated = .{ | ||
.file = bin.generated.file, | ||
.up = 1, | ||
.sub_path = "bun-test.o", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you file an issue with Zig asking for a better way to do this and link it here as a TODO?
Tests in other files cannot be universially included via |
What does this PR do?
Lets us write and run unit tests directly in Zig.
Running Zig unit tests in CI is blocked by ziglang/zig#23281. We can un-comment relevant code once this is fixed.
Workflow
Test binaries can be made for any kind of build. They are called
<bun>-test
and live next to their correspondingbun
bin. For example, debug tests compile tobuild/debug/bun-debug-test
.Test binaries re-use most cmake/zig build steps from normal bun binaries, so building one after a normal bun build is pretty fast.
How did you verify your code works?
I tested that my tests run tests.